<?php

namespace App\Http\Requests\Admin\Customer\Product;

use App\Http\Requests\ApiRequest;
use Illuminate\Validation\Rule;

/**
 * @property string keyword
 * @property string store_id
 * @property string brand_id
 * @property string category_id
 * @property string is_sale
 * @property string is_deleted
 * @property string is_hot
 * @property string is_new
 * @property array order_bys
 */
class StoreProductIndexRequest extends ApiRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'keyword'     => ['nullable', 'string'],
            'brand_id'    => 'nullable|int|min:1',
            'category_id' => 'nullable|int|min:1',
            'is_sale'     => ['nullable', 'int', Rule::in([0, 1])],
            'is_deleted'  => ['nullable', 'int', Rule::in([0, 1])],
            'is_hot'      => ['nullable', 'int', Rule::in([0, 1])],
            'is_new'      => ['nullable', 'int', Rule::in([0, 1])],
            'order_bys'   => ['nullable', 'array'],
            'store_id'    => 'nullable|int|min:1'
        ];
    }
}
